Skip to content

feat(ui): the web UI 1.39 with OpenTelemetry, Sentry v2 and Xdebug pages - #376

Closed
roxblnfk wants to merge 34 commits into
masterfrom
feat/frontend-update
Closed

roxblnfk wants to merge 34 commits into
masterfrom
feat/frontend-update

Conversation

@roxblnfk

Copy link
Copy Markdown
Member

What was changed

How it works

  • On a shared port, a browser GET of a UI page and a same-origin /api/ call go to the UI; every other request stays an HTTP dump.
  • The UI menu lists the modules Trap runs (/api/settings → events); pages of Buggregator Server features Trap has not (mock server, self-update, metrics) show no data.
  • The debugger API takes only same-origin requests with JSON writes and refuses the WebSocket RPC.

Why?

The UI 1.39 brings OpenTelemetry, the Xdebug pages and many fixes; Trap follows its API to stay usable with it.

Checklist

  • Tested
    • Tested manually: the UI in Chromium (Playwright) against a live Trap — dumps, pins, clear, Sentry/OTel tabs and service map, Xdebug session with breakpoints and stepping, Xdebug trace page, profiler
    • Unit tests added
    • Full suite on PHP 8.4 and 8.2, structarmed, psalm

Documentation

Updated in docs/ (web-ui, xdebug, xdebug-traces, opentelemetry, sentry, configuration, cli, mcp, http-dump, profiles) and in skills/trap/.

Review notes

  • Rebase-merge: each commit is a changelog line. Memory limits of the telemetry store (bytes, not only item counts) are left for a separate PR.
  • Without ext-protobuf, OTLP/protobuf requests over 20k elements get 413 (SDK batches of 512 spans pass; a Collector batch does not) — the pure-PHP parser would block Trap for seconds.

#372)

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…to the IDE (#375)

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
… store, lists (#373)

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
The Vite build of the UI replaces the Nuxt one, and its router uses the browser history. On a shared port a `GET` of a UI page that asks for HTML gets `index.html`, and the other requests stay HTTP dumps, a missing UI file included. The UI calls endpoints of the Buggregator Server that Trap has not, as `/api/update`, on every page load: an `/api/` call from a page of the same origin gets 404 instead of becoming an HTTP dump.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
- `POST`/`DELETE /api/event/{uuid}/pin` pin an event; every event has `is_pinned`. A clear with `keep_pinned` keeps the pinned events, and the events limit pushes them out last.
- `GET /api/event/{uuid}` answers 404 for a missing event; a 404 of a UI route is no longer taken for an HTTP dump.
- `/api/events/preview` takes `window` and `limit`.
- `/api/settings` gives `events` and the listener `ports` for the setup guide.
- An RPC call is answered with `{code, data}`, as the UI takes a call for done only on a 2xx code; an unknown or failed call gets 404 or 500 instead of no reply.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
The UI 1.39 takes `event.received` of the channel `events.project.{key}` of the project it shows, drops an event on `event.deleted` and loads its list again on `events.cleared`. A client is subscribed to the project channels at connect and to a new one before its first publication: centrifuge-js drops a publication of an unknown channel. `Frontend\Publisher` publishes `{event, data}` to a channel for any module.

An RPC method of no HTTP verb, as `ping` or `foo:api/x`, threw out of the RPC handler and ended the connection; it is answered with code 400 now.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…ng one

A parameter the route method cannot take, as `?project[]=x`, a `#[QueryParam]` of a wrong type and a missing required parameter got 500 over HTTP and RPC. The router throws `InvalidRouteArgument` for a query parameter of a wrong type, and the UI answers all of them with 400; a TypeError of the route code itself still gets 500.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
The UI 1.39 calls it along with every clear of the events and reports the whole clear failed when it fails. It deletes the Sentry events of `project`, keeping the pinned ones with `keep_pinned`.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
The UI lists the attachments of a mail at `/api/smtp/attachments/{event}` and downloads one at `/api/smtp/attachments/{event}/{attachment}`; the images the HTML embeds are served there too. The list answers 404 for a missing mail.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
The UI 1.39 lists them from `payload.request.files` and downloads one at `/api/http-dump/attachments/{event}/{file}`. `Content-Disposition` of a downloaded file, a mail attachment too, has the name in `filename*` (RFC 6266) and an ASCII fallback in `filename`, as a percent-encoded `filename` may be saved literally; a file of an empty name downloads as `unnamed`.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…ofiles

- The flame chart takes `?metric=wt|cpu|mu|pmu` for the widths of its spans.
- `GET /api/profiler/compare?base=&compare=` lists the 100 functions whose exclusive wall time and memory changed most, with their calls.
- Top functions, the call graph and the flame chart of an event that is no profile, or of no event, get 404 instead of 500.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…ir URL

A caught email's script opened at /api/smtp/{uuid}/html ran as a page of the UI origin and could pass the same-origin guard of the debugger. The 1.39 UI shows the HTML in a sandboxed frame and doesn't use that URL.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
The UI is opened from Trap itself, so it needs no CORS: no response of the
UI carries `Access-Control-*` headers now, and the UI answers no `OPTIONS`
request. An `OPTIONS` request goes on to the HTTP dump like any other one;
before, the UI answered it on its shared port and it was never dumped. That
change of what users see makes it a fix.

The debugger keeps its own guard: `Sec-Fetch-Site`, JSON-only writes, no
RPC. A cross-origin page gets no preflight answer for any endpoint now.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
… of the UI

Reconciles the Xdebug debugger and traces (#372, #375) and the Sentry and OpenTelemetry pages (#373, #374) with the UI 1.39 changes above.

- The Xdebug code publishes through the `Publisher` and `ConnectionPool` of the UI; the `Publisher` of #375 and its test are gone.
- Controllers answer statuses by `Message\Error` and `Message\Status`, not by a PSR response: the Router passes no response through and sends a 204 empty. `Error::withBody()` keeps the `{error, code, state}` and `{error}` bodies of the Xdebug pages. The Router still passes `__request` last; the RPC drops a field of that name, so the debugger answers it `403 http_only`.
- `/api/settings` lists `ports.xdebug` while the debugger is on, through `Frontend\ProvidesUiPorts`.
- `DELETE /api/sentry/all` clears the project's traces, logs and metrics too, and keeps the pinned Sentry events when the UI asks so.
- Tests that publish connect their client first: the pool publishes to connected clients only.
- Docs and the skill: the Xdebug page and the debugger port in the setup guide, the Sentry pages and the telemetry limits, the remaining no-data pages.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
The lock is resolved on PHP 8.2, the lowest supported version, so it installs there: Symfony 7.4 and no polyfill for PHP 8.5.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk
roxblnfk requested a review from a team November 21, 2026 22:37
@github-actions github-actions Bot added enhancement New feature or request tests Changes in the tests labels Nov 21, 2026
@codecov

codecov Bot commented Nov 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.26%. Comparing base (8562a7d) to head (de1b62c).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #376      +/-   ##
==========================================
- Coverage   82.34%   80.26%   -2.08%     
==========================================
  Files         338      424      +86     
  Lines       12787    16858    +4071     
==========================================
+ Hits        10529    13531    +3002     
- Misses       2258     3327    +1069     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

…d UI routing

- xdebug.md: `stop`, `wait` and `timeout` defaults, `session_id`, `id` to remove
  a breakpoint, conditions need eval, TRAP_XDEBUG_ALLOW_CONTROL, the modes,
  DBGp on any port, the tools failing without `--xdebug`
- mcp.md: the `xdebug-trace` type and how to find it, `1w`, `clear_events`
  deleting pinned events, the TTL and span limit of OpenTelemetry traces
- server.md: what the UI takes on a shared port, port 9003, the full list of
  server variables with TRAP_TRACES_*, TRAP_TELEMETRY_* and the 413 of
  TRAP_HTTP_MAX_INFLATED_SIZE
- integrations.md, profiling.md: the 413 and 400 answers of Sentry, OTLP and
  Xdebug traces, `-p` replacing the default ports, UI paths that are not dumps
- SKILL.md routes the web UI, limits and 4xx answers; detect.php points at
  xdebug.md and the traces

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…ents`, UI API routes

Also the Xdebug references of the agent skill, and which `trap.xml` path has no
environment variable.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…d` is set

`clear_events` deletes the events the user pinned in the web UI only with
`include_pinned: true`; otherwise it keeps them and reports their number in
`kept_pinned`.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Besides the profiles, dumps, mails and Sentry events, `trap test` now sends
Monolog records, Ray payloads, two HTTP dumps (one uploading a file), an SPX
and a Speedscope profile, an Xdebug function trace, the Sentry envelopes of a
failed request (error, transaction with spans, logs, trace metrics), an
OpenTelemetry trace across two services with its logs and metrics, and a Sentry
error of a second project. One run fills every page of the web UI.

Times and IDs come from JSON templates in resources/payloads, so the data falls
into the period filters of the UI. A part Trap refuses is reported and the
command exits with an error.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
While PHP has an exception in flight its streams open nothing, so Xdebug
answers `source` with error 100 at an exception break: `xdebug_location`
and the source pane failed there. Trap now reads the file from its own
host then, when it has one at that path.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…s with their line

- `xdebug_wait`, `xdebug_continue`, `xdebug_location` and `xdebug_sessions`
  carry the `exception` of an exception break: class, message, code.
- `xdebug_eval` fails on a warning or notice of the expression, as an
  undefined variable, and PHP no longer prints it into the script's output.
- `xdebug_continue` returns the function and the code of the line it
  stopped at.
- `xdebug_stack` returns 20 frames by default, `limit` for more, and the
  total.
- `xdebug_breakpoints` lists each breakpoint with the line Xdebug resolved
  it to and its hit count in the live sessions; the UI gets the real hit
  counts too.
- The MCP instructions name the `xdebug_*` tools.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…ap of its own on Windows

The Xdebug reference tells where the exception of a pause is, why `*`
stops a dozen times in vendor code, where stepping lands, how a
breakpoint moves and where its resolved line shows, the frame eval runs
in, `pause_on_first_line`, and Windows paths. server.md gets a working
PowerShell recipe (php as a .bat wrapper, `$env:` lasting for the shell);
detect.php reports whether the Xdebug port is free and who holds it.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
… script ran

Trap read any `file://` URI from its host when Xdebug couldn't: a file
named by a breakpoint, a path relative to Trap's directory, a network
share, another stream wrapper, and whole into memory. Now only a file
the session reported running (its entry file, a pause, a stack frame),
by a plain local path, up to 4 MB, read line by line with lines cut at
64 KB.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…statements again

The `@` and `error_get_last()` of the eval erased the script's last
error, and missed every warning under an error handler of the script, as
Testo, Laravel and Symfony set: it printed into the output and the call
succeeded. An error handler of Trap now sits on top during the eval:
it takes the warnings and notices of the eval code, and passes the
script's own errors to its handler. The code goes to Xdebug as written
again, so `$a + 1;` and `1; 2` work. A step waits for a read in flight.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…ter the run

- `xdebug_continue` returns the `return_value` of the function a
  `step_out` left (Xdebug's `breakpoint_include_return_value`).
- Trap reads the hit counts at each pause, and `xdebug_breakpoints` lists
  the state in the last closed session too, with `session_state`: the
  counts of a finished run stay readable.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…erShell tips

The eval line now matches the handler (warnings and notices, the
script's handler untouched). New: finding the line of an unread
function, learning the class an exception break needs, conditions that
fail silently, where moved breakpoints and exception breaks land, return
values, the slowdown, long variable lists, JSON on stdin from
PowerShell, the recipe's logs in the temp directory and a port check.
detect.php takes `xdebug.client_port`, suggests a free port and reads
netstat in any language; SKILL.md says its probes leave an event.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…PHP files

A fake engine could still name any file as its entry, pause or frame.
Trap reads a file itself now only when Xdebug connected from a loopback
address, whose paths are this host's, and only a non-empty file with a
PHP source extension: no `/proc/self/environ`, no `win.ini`.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
… out

- A timed-out eval left Trap's error handler on top of the script's, and
  the script's own `restore_error_handler()` then took the wrong one.
  The release goes to Xdebug anyway now, which runs it after the
  expression; an eval also drops a handler of Trap left on top.
- A trailing `//` comment works again: the code ends with a line break.
- An error is named by its level, as `PHP Error` for `E_USER_ERROR`, and
  `@`, which has no effect in an eval, is no longer read.
- The script's handler gets every argument, as PHP 7 handlers take five.
- The handler class is declared once per script.
- A step waits for an eval in flight as long as the eval may take.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…e detect's port hint

The skill says `@` has no effect in an eval and points to `??`; reads
`xdebug_stack`'s `limit` as an argument; shows the `list` action; tells
that `*` also stops in the test runner and that an ended run shows
`state: stopped`; and walks one run from a conditional breakpoint to
`return_value` in PowerShell. detect.php says when it finds no free port.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
… the source can't be read

- After `step_out` Xdebug keeps the function that returned on top of the
  stack, at its own line: `where` named it beside the caller's line. Now
  `where` is the function of the paused line, and `returned_from` names
  the one whose `return_value` it is.
- `xdebug_location` takes the line Xdebug paused at, and returns it, the
  function and the exception with a `source_unavailable` note when no
  source can be read, instead of failing.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
…ines

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
… the loopback rule

The example now calls mcp.php and Xdebug on the ports of the server.md
recipe and waits for the test or stops it; docs/xdebug.md says Docker
Desktop may present a container as 127.0.0.1 and lists `.php5`-style
names; detect.php names the ports it tried.

Assisted-By: Claude Opus 5.5 <noreply@anthropic.com>
@roxblnfk

Copy link
Copy Markdown
Member Author

Landed on master as a fast-forward of the signed series 9f45d49..6fcd72c (the same tree as this branch's head de1b62c, with the follow-up fixes of the unreleased Xdebug debugger folded into its commit).

@roxblnfk roxblnfk closed this Nov 22, 2026
@roxblnfk
roxblnfk deleted the feat/frontend-update branch November 23, 2026 11:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request tests Changes in the tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant